<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            width: 300px;
            height: 300px;
            background-color: #f00;
        }

        .son {
            width: 100px;
            height: 100px;
            background-color: #0f0;
        }
    </style>
</head>
<body>
    <div id="app">
        <!-- 
            .self： 事件只能由自身触发，无法通过冒泡触发
         -->
        <div @click.self="fn1" class="box">
            <!-- .once 代表事件只能触发一次 -->
            <div @click.once="fn2" class="son">我是小盒子</div>
            <button @click="fn3">我是按钮</button>
        </div>
    </div>
    <script src="./vue.js"></script>
    <script>
        new Vue({
            el: '#app',
            methods: {
                fn1 () {
                    alert('父盒子被点')
                },
                fn2 () {
                    alert('子盒子被点')
                },
                fn3 () {
                    alert('按钮被点')
                },
            }
        })
    </script>
</body>
</html>